﻿<%@ Control Language="C#" %>
<%@ Register src="../module/Admincenter-Menu-Child.ascx" tagname="ChildMenu" tagprefix="inal" %>
<script runat="server">

    private int Item_typ = 1;
    private int cid = 0;
    private int lang = 1;
    private Boolean is_show_staticize = false;
    protected void Page_Load(object sender, EventArgs e)
    {
        Item_Typ = Utils.GetQueryString("menu_typ", 1);
        Cid = Utils.GetQueryString("cid", 0);
        Item_Lang = Utils.GetQueryString("lang", 1);
        if (Item_Typ == 2)
            Is_Show_Staticize = true;
        Menubar menus = new Menubar();
        Repeater_List.DataSource = menus.List(Item_Typ, Item_Lang, Cid);
        Repeater_List.DataBind();
    }
    public int Item_Lang
    {
        get { return lang; }
        set { lang = value; }
    }
    public int Item_Typ
    {
        get { return Item_typ; }
        set { Item_typ = value; }
    }
    public int Cid
    {
        get { return cid; }
        set { cid = value; }
    }
    public bool Is_Show_Staticize
    {
        get { return is_show_staticize; }
        set { is_show_staticize = value; }
    }
    public string HtmlUrl(object dataitem)
    {
        /*
         * m/News-List.aspx?&Cid=8&lang=1&RCid=8
           m/News-List-Cid8lang1RCid8.html
         * m/News-List-Cid8lang1RCid8.html
         */
        string temp = DataBinder.Eval(dataitem, "Item_Url").ToString();
        temp = Utils.GetStaticizeUrl(temp, "html", null);
        return temp;

    }
</script>
<table class="childs">
<thead>
    <tr>
        <td class="w50"></td>
        <td class="w200"><%=Lang.Show("UrlName")%></td>
        <td class="w200"><%=Lang.Show("Link")%></td>
        <td class="w50"><%=Lang.Show("Order")%></td>
        <td class="w50"><%=Lang.Show("position")%></td>
        <td><%=Lang.Show("Introduction")%> </td>
        <td><%=Lang.Show("Create_Time")%></td>
        <td class="Narrow"></td>
        <%if (Is_Show_Staticize) { %><td class="Narrow"></td><%} %>
        <td class="Narrow"></td>
        <td class="Narrow"></td>
    </tr>
</thead>
<tbody>
<asp:Repeater runat="server" ID="Repeater_List">
<ItemTemplate>
    <tr id="TR<%#Eval("Item_Id") %>" class="root_tr">
        <td><input type="checkbox" class="checkbox"  /></td>
        <td><%#Eval("Item_Name")%></td>
        <td><code class="block"><%#Eval("Item_Url")%></code></td>
        <td><code class="block"><%#Eval("Orders")%></code></td>
        <td><img src="../static/img/p<%#Eval("Item_Position")%>.png" /></td>
        <td><p><%#Eval("Item_Introduction")%></p></td>
        <td><code title="<%#Eval("Create_Time")%>"><%#Eval("Create_Time","{0:yyyy/MM/dd}")%></code></td>
        <%if (!Is_Show_Staticize){ %><td><a href="Menu-AddEdit.aspx?root_id=<%#Eval("Item_Id") %>&menu_typ=<%#Eval("Item_Typ") %>&lang=<%=Item_Lang %>"><%=Lang.Show("ChildMenu") %></a></td>
        <%} else{ %>
        <td><a target="_blank" href="<%#HtmlUrl(Container.DataItem)%>">HTML</a></td>
        <td><a id="A<%#Eval("Item_Id") %>" href="javascript:Staticize_Default('<%#Eval("Item_Url")%>')"><%=Lang.Show("Refresh")%></a></td>
        <%} %>
        <td><a href="Menu-AddEdit.aspx?id=<%#Eval("Item_Id") %>&menu_typ=<%#Eval("Item_Typ") %>&cid=<%#Eval("Cid") %>&lang=<%=Item_Lang %>"><%=Lang.Show("Edit") %></a></td>
        <td><a href="javascript:Del(<%#Eval("Item_Id") %>,6)" class="del"><%=Lang.Show("Del") %></a></td>
    </tr>
    <%if (!Is_Show_Staticize){ %>
        <inal:ChildMenu Root_ID='<%#Utils.ToInt(Container.DataItem,"Item_Id") %>' runat="server" />
    <%} %>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>